{% extends "package/base.html" %}

{% load crispy_forms_tags i18n page_metadata_tags %}

{% block metadata %}
    {% translate " package" as trans_title %}
    {% page_metadata page_title=action|title|add:trans_title %}
{% endblock metadata %}

{% block body %}

    <h2><a href="{% url 'home' %}">{% translate "home" %}</a> / <a href="{% url 'packages' %}">{% translate "packages" %}</a> / {{ action|title }} {% translate "flag" %}</h2>

    <p id="package-form-message"></p>
    <form action="{{ request.path }}" method="post" id="package-form">
        {{ form.errors }}
        <input type="hidden" name="temp" id="temp" value="" />
        {% csrf_token %}
        <fieldset>
            {{ form|crispy }}
        </fieldset>

        <input class="btn btn-default" type="submit" name="add" value="{{ action }} {% translate "Submit" %}">
    </form>

{% endblock body %}

{% block extra_body %}
    <script src="{{ STATIC_URL }}js/urlify.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}js/package_form.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            package_form(eval({{ repo_data|safe }}));
        });
    </script>

{% endblock extra_body %}
